//package com.qianli.cashmama.trade.openApi.job;
//
//import com.fqgj.common.utils.DateUtil;
//import com.fqgj.common.utils.StringUtils;
//import com.fqgj.xjd.user.client.enums.UserContactFamilyTypeEnum;
//import com.fqgj.xjd.user.client.enums.UserEducationEnum;
//import com.fqgj.xjd.user.client.enums.UserLanguageEnum;
//import com.fqgj.xjd.user.client.response.UserFamilyContact;
//import com.fqgj.xjd.user.client.response.UserFriendContact;
//import com.fqgj.xjd.user.client.response.UserInfo;
//import com.fqgj.xjd.user.client.response.UserPanInfo;
//import com.qianli.cashmama.trade.domain.model.BillBase;
//import com.qianli.cashmama.trade.domain.model.TradeBase;
//import com.qianli.cashmama.trade.integration.user.dto.UserBaseInfoDto;
//import com.qianli.cashmama.trade.openApi.job.vo.ClOrderInputVo;
//import com.qianli.cashmama.trade.openApi.job.vo.ClOrderReceiveRequest;
//import com.qianli.cashmama.trade.openApi.job.vo.ClUserInfoInputVo;
//
///**
// * Created with IntelliJ IDEA.
// * User: sm
// * Date: 2021/12/7
// * Time: 6:46 下午
// */
//public class PushToCollectionSimple {
//
//
//
//    public void run(BillBase billBase, TradeBase tradeBase, UserBaseInfoDto userBaseInfoDto, UserInfo userInfo, UserPanInfo userPanInfo
//    ){
//        //组装订单信息
//        ClOrderInputVo clOrderInputVo = new ClOrderInputVo();
//        clOrderInputVo.setBorrowCapital(billBase.getBorrowCapital().toPlainString());
//        clOrderInputVo.setReceivedCapital(billBase.getReceivedCapital().toPlainString());
//        clOrderInputVo.setPaidAmount(billBase.getPaidCapital().subtract(billBase.getDiscountCapital()).toPlainString());
//        clOrderInputVo.setDeductAmount(billBase.getDiscountCapital().toPlainString());
//        clOrderInputVo.setInterest(billBase.getInterestFee().toPlainString());
//        clOrderInputVo.setServiceFee(billBase.getBorrowServiceFee().toPlainString());
//        clOrderInputVo.setLateServiceFee(tradeBase.getOverdueServiceFee().toPlainString());
//        clOrderInputVo.setLateFeeRatio(tradeBase.getOverdueRatio().toPlainString());
//        clOrderInputVo.setChannel(tradeBase.getChannelCode());
//        clOrderInputVo.setReceivedDate(DateUtil.getDate(tradeBase.getReceivedDate(), "yyyy-MM-dd HH:mm:ss"));
//        clOrderInputVo.setRepaymentDate(DateUtil.getDate(billBase.getRepaymentDate(), "yyyy-MM-dd HH:mm:ss"));
//        clOrderInputVo.setBorrowType(tradeBase.isNewUser() ? 1 : 2);
//        clOrderInputVo.setCapitalCode(tradeBase.getCapitalCode() + "");
//        clOrderInputVo.setExtensionNumber(billBase.getExtensionCount());
//
//        //组装用户信息
//        ClUserInfoInputVo clUserInfoInputVo = new ClUserInfoInputVo();
//        clUserInfoInputVo.setName(userBaseInfoDto.getUserName());
//        clUserInfoInputVo.setMobile(userBaseInfoDto.getMobile());
//        clUserInfoInputVo.setKycNo(userBaseInfoDto.getIdentityNo());
//        clUserInfoInputVo.setEmail("");
//
//        clUserInfoInputVo.setUserLanguage(UserLanguageEnum.getEnumByType(userBaseInfoDto.getUserLanguage()) == null ?
//                null : UserLanguageEnum.getEnumByType(userBaseInfoDto.getUserLanguage()).getDesc());
//        clUserInfoInputVo.setState(userInfo.getUserResident().getProvince());
//        clUserInfoInputVo.setCity(userBaseInfoDto.getCity());
//        clUserInfoInputVo.setAddress(userInfo.getUserResident().getAddress());
//
//        Integer sex = 1;
//        if (userBaseInfoDto.getGender() == 1) {
//            sex = 1;
//        } else if (userBaseInfoDto.getGender() == 2) {
//            sex = 0;
//        } else if (userBaseInfoDto.getGender() == 3) {
//            sex = 2;
//        }
//        clUserInfoInputVo.setSex(sex);
//        clUserInfoInputVo.setBirthday(userBaseInfoDto.getBirthday());
//        clUserInfoInputVo.setPanCardNo(userPanInfo.getCardNo());
//        clUserInfoInputVo.setAadhaarNo(userInfo.getUser().getIdentityNo());
//        UserEducationEnum userEducationEnum = UserEducationEnum.getEnumByType(userInfo.getUserBase().getEducation());
//        clUserInfoInputVo.setEducation(userEducationEnum == null ? UserEducationEnum.BELOW_HIGH_SCHOOL.getType() : userEducationEnum.getType());
//        clUserInfoInputVo.setMarriedStatus(userInfo.getUserBase().getMarriedStatus());
//        UserFamilyContact userFamilyContact = userTradeSnapshotDto.getUserSocialContact().getUserEmergencyContact().getUserFamilyContact();
//        clUserInfoInputVo.setContact1Name(StringUtils.isNotEmpty(userFamilyContact.getContactName()) ? userFamilyContact.getContactName() : userFamilyContact.getName());
//        clUserInfoInputVo.setContact1Mobile(userFamilyContact.getMobile());
//
//        Integer contact1Relative = 6;
//        UserContactFamilyTypeEnum userContactFamilyTypeEnum = userTradeSnapshotDto.getUserSocialContact().getUserEmergencyContact().getUserFamilyContact().getUserContactFamilyTypeEnum();
//        if (UserContactFamilyTypeEnum.MOTHER.equals(userContactFamilyTypeEnum) || UserContactFamilyTypeEnum.FATHER.equals(userContactFamilyTypeEnum)) {
//            contact1Relative = 1;
//        } else if (UserContactFamilyTypeEnum.Brother.equals(userContactFamilyTypeEnum)) {
//            contact1Relative = 2;
//        } else if (UserContactFamilyTypeEnum.SISTERS.equals(userContactFamilyTypeEnum)) {
//            contact1Relative = 3;
//        } else if (UserContactFamilyTypeEnum.Spouse_OR_Partner.equals(userContactFamilyTypeEnum)) {
//            contact1Relative = 5;
//        } else {
//            contact1Relative = 6;
//        }
//
//        clUserInfoInputVo.setContact1Relative(contact1Relative);
//
//        UserFriendContact userFriendContact = userTradeSnapshotDto.getUserSocialContact().getUserEmergencyContact().getUserFriendContact();
//        clUserInfoInputVo.setContact2Name(StringUtils.isNotEmpty(userFriendContact.getContactName()) ? userFriendContact.getContactName() : userFriendContact.getName());
//        clUserInfoInputVo.setContact2Mobile(userFriendContact.getMobile());
//        clUserInfoInputVo.setContact2Relative(6);
//        clUserInfoInputVo.setPinCode(userInfo.getUserResident().getPinCode());
//
//        //组装基础信息
//        ClOrderReceiveRequest request = new ClOrderReceiveRequest();
//        request.setToken("1989919");
//        request.setTradeNo(tradeBase.getTradeNo());
//        request.setOrderBillNo(billBase.getBillNo());
//        request.setUserCode(tradeBase.getUserCode());
//        String appName =  tradeBase.getProductCategory();
//        request.setAppName(appName);
//        request.setProductType(tradeBase.getProductCategory());
//        request.setProductCode(tradeBase.getProductCode());
//
//        request.setUserInfo(clUserInfoInputVo);
//        request.setOrderInfo(clOrderInputVo);
//    }
//}
